#ifndef THREADPOOL_H
#define THREADPOOL_H
#include<mycpplearn.h>
#include"mysql.h"

//小火车
typedef struct train_s{
    int train_len;
    char train_data[1024];
}train_t;

//worker结构体
typedef struct worker_s{
    pthread_t *tid;
    int workerNum;
}worker_t;



//任务队列结构体
typedef struct taskNode_s{
    int taskId;        //netfd
    char taskContent[1024];//cmd
    struct taskNode_s* next;
}taskNode_t;

typedef struct taskQueue_s{
    taskNode_t* head;
    taskNode_t* tail;
    int taskNum;
}taskQueue_t;

//线程池结构体
typedef struct threadPool_s{
    worker_t worker;
    taskQueue_t taskQueue;
    pthread_mutex_t mutex;
    pthread_cond_t cond;
    MysqlPool_t* mysql_pool;
    int epfd;
    int shutdownFlag;
}threadPool_t;
//初始化线程池
int threadPoolInit(threadPool_t* pool, int threadNum, int taskQueueLen);




#endif

